home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / ModuleSources / HSSetDTMF.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-11  |  2.8 KB  |  107 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Module Name:    HSSetDTMF                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        HSSetDTMF.c                                                                    */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1994-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1994-07-29    Jaakko Railo        Original version                                        */
  15. /*                                                                                                */
  16. /************************************************************************************************/
  17.  
  18. /****************************************** DESCRIPTION ******************************************
  19.  
  20. *************************************************************************************************/
  21.  
  22. /******************************************** HEADERS *******************************************/
  23.  
  24. #ifndef __TELEPHONES__
  25. #include "Telephones.h"
  26. #endif
  27.  
  28. #include "TestModule.h"
  29.  
  30. /****************************************** DEFINITIONS *****************************************/
  31.  
  32. #define    rDisplayHSSetDTMFDLOG    10000
  33. #define    kDTMFOnItem                2
  34. #define    kDTMFOffItem            3
  35. #define    kDTMFOn                    1
  36. #define    kDTMFOff                0
  37.  
  38. /****************************************** PROTOTYPES ******************************************/
  39.  
  40. short         DisplayHSSetDTMF (void);
  41. void         DoTest (CHRSPtr paramPtr);
  42.  
  43. /************************************************************************************************/
  44. /************************************************************************************************/
  45.  
  46.  
  47. pascal short TestModule (CHRSPtr paramPtr)
  48. {
  49.     short    returnValue = noErr;
  50.     
  51.     if (paramPtr->version <= kTestModuleVersion) {
  52.         
  53.         DoTest (paramPtr);
  54.         
  55.     }
  56.     else
  57.         returnValue = kWrongVersion;
  58.         
  59.     return (returnValue);
  60. }
  61.  
  62.  
  63. short DisplayHSSetDTMF (void)
  64. {
  65.     short        itemHit;
  66.     DialogPtr    theDialog;
  67.     
  68.     if ((theDialog = GetNewDialog (rDisplayHSSetDTMFDLOG, nil, (WindowPtr)(-1L))) != nil) {
  69.         
  70.         ShowWindow (theDialog);
  71.         
  72.         ModalDialog (nil, &itemHit);
  73.         
  74.         DisposeDialog (theDialog);
  75.     }
  76.     else
  77.         itemHit = -1;
  78.     
  79.     return (itemHit);
  80. }
  81.  
  82.  
  83. void DoTest (CHRSPtr paramPtr)
  84. {
  85.     TELHandle    termHand = GetCurrentTELHandle (paramPtr);
  86.     short        itemHit;
  87.     OSErr        errCode;
  88.     Boolean        dtmf;
  89.     
  90.     itemHit = DisplayHSSetDTMF ();
  91.     if ((itemHit == kDTMFOnItem) || (itemHit == kDTMFOffItem)) {
  92.         
  93.         dtmf = (itemHit == kDTMFOnItem)?kDTMFOn:kDTMFOff;
  94.         
  95.         if ((errCode = TELHSSetDTMF (termHand, dtmf)) == noErr)
  96.             Print (paramPtr, "TELHSSetDTMF --> DTMF = %s", 
  97.                     ((dtmf==kDTMFOn)?"DTMFOn":"DTMFOff"));
  98.         else
  99.             Print (paramPtr, "### TELHSSetDTMF failed : %d", errCode);
  100.     }
  101.     else
  102.         if (itemHit == -1)
  103.             Print (paramPtr, "### Unable to get a DLOG resource");
  104. }
  105.  
  106.  
  107.